home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1995 / MacHack 1995.toast / Presentations / Presentations ’92 / Mike Engber (LISP) / DTDB.lisp next >
Lisp/Scheme  |  1992-06-07  |  2KB  |  71 lines

  1. (oou-dependencies :macptr-u)
  2.  
  3. ;;
  4. ;;init the DTDB refNum
  5. ;;
  6. (rlet ((pb :DTPBRec
  7.            :ioNamePtr (%null-ptr)
  8.            :ioVRefNum 0))
  9.   (#_PBDTGetPath pb)
  10.   (pref pb :DTPBRec.ioDTRefNum))
  11.  
  12. (defvar *DTDB-refNum* 848)
  13.  
  14.  
  15. ;;
  16. ;; GetComment
  17. ;;
  18. (with-pstrs ((fn "HD:TeachText"))
  19.   (%stack-block ((buf 200))
  20.     (rlet ((pb :DTPBRec
  21.                :ioNamePtr  fn
  22.                :ioDTRefNum *DTDB-refNum*
  23.                :ioDTBuffer buf
  24.                :ioDirID    0))
  25.       (when (zerop (#_PBDTGetComment pb))
  26.         (%get-text buf (pref pb :DTPBRec.ioDTActCount))))))
  27.  
  28.  
  29. ;;
  30. ;; GetIconInfo
  31. ;;
  32. (rlet ((pb :DTPBRec
  33.            :ioDTRefNum    *DTDB-refNum*
  34.            :ioIndex       1
  35.            :ioTagInfo     0
  36.            :ioDTReqCount  1024
  37.            :ioFileCreator "RSED"))
  38.  
  39.    (format t "~%~2@a: ~s  ~3@s   ~4@s~%" #\# 'type 'icon 'size)
  40.  
  41.   (loop
  42.     
  43.     ;;break when #$afpItemNotFound
  44.     (unless (zerop (#_PBDTGetIconInfo pb)) (return (pref pb :DTPBRec.ioResult)))
  45.     
  46.     (format t "~2@s: ~s  ~3@s   ~4@s~%"
  47.             (pref pb :DTPBRec.ioIndex)
  48.             (symbol-name (pref pb :DTPBRec.ioFileType))
  49.             (pref pb :DTPBRec.ioIconType)
  50.             (pref pb :DTPBRec.ioDTActCount))
  51.     
  52.     (incf (pref pb :DTPBRec.ioIndex))))
  53.  
  54.  
  55. ;;
  56. ;; check out paul
  57. ;;
  58. (%stack-block ((buf #$kLarge8BitIconSize))
  59.   (rlet ((pb :DTPBRec
  60.              :ioDTRefNum    *DTDB-refNum*
  61.              :ioTagInfo     0
  62.              :ioDTBuffer    buf
  63.              :ioDTReqCount  #$kLarge8BitIconSize
  64.              :ioIconType    -1
  65.              :ioFileCreator "RSED"
  66.              :ioFileType    "paul"
  67.              ))
  68.     (when (zerop (#_PBDTGetIcon pb))
  69.       (print (pref pb :DTPBRec.ioDTActCount))
  70.       (%get-text buf (pref pb :DTPBRec.ioDTActCount)))))
  71.